package de.tabiteuea.gui.wizards;

import org.eclipse.jface.wizard.Wizard;

import de.tabiteuea.gui.models.ModelProvider;

/**
 * Wizard for creating a new project. Container for NewProjectWizardPage.
 * 
 * @author Sebastian Lippert
 */

public class NewProjectWizard extends Wizard {

	private NewProjectWizardPage page;

	/**
	 * Constructor
	 */

	public NewProjectWizard() {
		setWindowTitle(Messages.NewProjectWizard_new);
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
	 */
	
	@Override
	public void addPages() {

		// create page and add them to this wizard
		page = new NewProjectWizardPage();
		addPage(page);
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
	 */
	
	@Override
	public boolean performFinish() {

		// OK was pressed. Get created InputModel from the page and register
		// this one at the ModelProvider.

		ModelProvider provider = ModelProvider.getInstance();
		provider.setInputModel(page.getModel());

		return true;
	}

}
